package com.example.mybatisplustest.service.serviceImpl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.mybatisplustest.entity.User;
import com.example.mybatisplustest.mapper.UserMapper;
import com.example.mybatisplustest.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author w5cSchool
 * @date 2021/11/5 23:35
 * description:
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    UserMapper userMapper;

    @DS("slave")
    @Override
    public User index(){
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("name","jack");
        User user = userMapper.selectOne(wrapper);
        return user;
    }
}
